package com.xiaoxi.factroymethodmode.factory;

import com.xiaoxi.factroymethodmode.product.IDCardProduct;
import com.xiaoxi.factroymethodmode.product.Product;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName IDCardFactory
 * @Description
 * @Author xiaoxi
 * @Date 2023/3/9 22:37
 * @Version 1.0
 */
@Data
public class IDCardFactory extends Factory {

    private List<Object> productList = new ArrayList<>();

    @Override
    public synchronized Product createProduct(String product) {
        return new IDCardProduct(product);
    }

    @Override
    public void registerProduct(Product product) {
        IDCardProduct idCardProduct = (IDCardProduct) product;
        productList.add(idCardProduct);
    }

    @Override
    public List<Object> getFactory() {
        return productList;
    }


}
